const { CODE_EXPIRES_IN } = require('../../config/constants');
const mongoose = require("mongoose");
const { Schema } = mongoose;
const verifyCodeSchema = new Schema({
    receiver: {
        type: String,
        required: true
    },
    scene: {
        type: String,
        required: true
    },
    used: {
        type: Boolean,
        default: false
    },
    code: {
        type: String,
        required: true,
        unique: true
    },
    createdAt: {
        type: Date,
        default: Date.now,
        expires: CODE_EXPIRES_IN * 60
    }
});
const VerifyCode = mongoose.model('VerifyCode', verifyCodeSchema);
module.exports = {
    VerifyCode
};
